package com.bharat.matriService.dao;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.bharat.matriService.dao.mappers.EnumerationsRowMapper;
import com.bharat.matriService.model.Enumerations;

@Repository
public class CommonDaoImpl implements CommonDao, Serializable{

	private static final long serialVersionUID = 3321156119445179810L;

	private JdbcTemplate jdbcTemplate;
	
	private String queryEnumerationsByGroup;
	
	public CommonDaoImpl() {
	}

	@Autowired
	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}
	
	public void setQueryEnumerationsByGroup(String queryEnumerationsByGroup) {
		this.queryEnumerationsByGroup = queryEnumerationsByGroup;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Enumerations> getEnumeration(String enumGroup) {
		
		List<Enumerations> lst = new ArrayList<Enumerations>();
		Map<String,String> params = new HashMap<String, String>();
		params.put("enumGroup", enumGroup);
		lst = (List<Enumerations>) this.jdbcTemplate.queryForObject(queryEnumerationsByGroup, new EnumerationsRowMapper());
		System.out.println(">>>>>>>>>lst : "+lst);
		return lst;
	}

}
